package com.mofeng.myshop.until;

import com.hankcs.hanlp.HanLP;
import jakarta.servlet.http.HttpServletRequest;

import java.util.ArrayList;
import java.util.List;

public class TextUtils {
    public static String getDomain(HttpServletRequest request) {
        String servletPath = request.getServletPath();
        StringBuffer requestURL = request.getRequestURL();
        String originalDomain = requestURL.toString().replace(servletPath, "");
        return originalDomain;
    }

    public static String getSummer(String article) {
        List<String> sentenceList = HanLP.extractSummary(article, 10);
        return sentenceList.toString();
    }

    public static boolean isPhoneOk(String phone) {
        return true;
    }

    public static void main(String[] args) {
        String str = "AdminCheat giveitem \"Blueprint'/Game/PrimalEarth/CoreBlueprints/Items/Armor/Metal/PrimalItemArmor_MetalHelmet.PrimalItemArmor_MetalHelmet'\" 1 3 0|AdminCheat giveitem \"Blueprint'/Game/PrimalEarth/CoreBlueprints/Items/Armor/Metal/PrimalItemArmor_MetalShirt.PrimalItemArmor_MetalShirt'\" 1 3 0|AdminCheat giveitem \"Blueprint'/Game/PrimalEarth/CoreBlueprints/Items/Armor/Metal/PrimalItemArmor_MetalGloves.PrimalItemArmor_MetalGloves'\" 1 3 0|AdminCheat giveitem \"Blueprint'/Game/PrimalEarth/CoreBlueprints/Items/Armor/Metal/PrimalItemArmor_MetalPants.PrimalItemArmor_MetalPants'\" 1 3 0|AdminCheat giveitem \"Blueprint'/Game/PrimalEarth/CoreBlueprints/Items/Armor/Metal/PrimalItemArmor_MetalBoots.PrimalItemArmor_MetalBoots'\" 1 3 0|AdminCheat giveitem \"Blueprint'/Game/PrimalEarth/CoreBlueprints/Weapons/PrimalItem_WeaponCrossbow.PrimalItem_WeaponCrossbow'\" 1 3 0|AdminCheat giveitem \"Blueprint'/Game/PrimalEarth/CoreBlueprints/Weapons/PrimalItemAmmo_ArrowTranq.PrimalItemAmmo_ArrowTranq'\" 100 0 0|AdminCheat giveitem \"Blueprint'/Game/PrimalEarth/CoreBlueprints/Weapons/PrimalItemAmmo_ArrowTranq.PrimalItemAmmo_ArrowTranq'\" 100 0 0|" +
                "AdminCheat giveitem \"Blueprint'/Game/PrimalEarth/CoreBlueprints/Weapons/PrimalItemAmmo_ArrowTranq.PrimalItemAmmo_ArrowTranq'\" 100 0 0|AdminCheat giveitem \"Blueprint'/Game/PrimalEarth/CoreBlueprints/Weapons/PrimalItem_WeaponMachinedShotgun.PrimalItem_WeaponMachinedShotgun'\" 1 3 0|AdminCheat giveitem \"Blueprint'/Game/PrimalEarth/CoreBlueprints/Weapons/PrimalItemAmmo_SimpleShotgunBullet.PrimalItemAmmo_SimpleShotgunBullet'\" 100 0 0|AdminCheat giveitem \"Blueprint'/Game/PrimalEarth/CoreBlueprints/Weapons/PrimalItemAmmo_SimpleShotgunBullet.PrimalItemAmmo_SimpleShotgunBullet'\" 100 0 0|AdminCheat giveitem \"Blueprint'/Game/PrimalEarth/CoreBlueprints/Weapons/PrimalItemAmmo_SimpleShotgunBullet.PrimalItemAmmo_SimpleShotgunBullet'\" 100 0 0|AdminCheat giveitem \"Blueprint'/Game/PrimalEarth/CoreBlueprints/Weapons/PrimalItem_WeaponMetalHatchet.PrimalItem_WeaponMetalHatchet'\" 1 3 0|AdminCheat giveitem \"Blueprint'/Game/PrimalEarth/CoreBlueprints/Weapons/PrimalItem_WeaponMetalPick.PrimalItem_WeaponMetalPick'\" 1 3 0|AdminCheat giveitem \"Blueprint'/Game/PrimalEarth/CoreBlueprints/Weapons/PrimalItem_WeaponSickle.PrimalItem_WeaponSickle'\" 1 3 0|AdminCheat giveitem \"Blueprint'/Game/ScorchedEarth/WeaponWhip/PrimalItem_WeaponWhip.PrimalItem_WeaponWhip'\" 1 3 0|AdminCheat giveitem \"Blueprint'/Game/PrimalEarth/Test/PrimalItem_WeaponGPS.PrimalItem_WeaponGPS'\" 1 3 0|AdminCheat giveitem \"Blueprint'/Game/PrimalEarth/Test/PrimalItem_WeaponMagnifyingGlass.PrimalItem_WeaponMagnifyingGlass'\" 1 3 0|AdminCheat giveitem \"Blueprint'/Game/PrimalEarth/Test/PrimalItem_WeaponSpyglass.PrimalItem_WeaponSpyglass'\" 1 3 0|" +
                "AdminCheat giveitem \"Blueprint'/Game/Aberration/WeaponGlowStickThrow/PrimalItem_GlowStick.PrimalItem_GlowStick'\"  20 0 0|AdminCheat giveitem \"Blueprint'/Game/Extinction/CoreBlueprints/Weapons/PrimalItem_WeaponEmptyCryopod.PrimalItem_WeaponEmptyCryopod'\" 1 0 0|AdminCheat giveitem \"Blueprint'/Game/PrimalEarth/CoreBlueprints/Items/Structures/Misc/PrimalItemStructure_Bed_Simple.PrimalItemStructure_Bed_Simple'\" 3 0 0|AdminCheat giveitem \"Blueprint'/Game/PrimalEarth/CoreBlueprints/Items/Armor/Saddles/PrimalItemArmor_AnkyloSaddle.PrimalItemArmor_AnkyloSaddle'\"  1 3 0|AdminCheat giveitem \"Blueprint'/Game/PrimalEarth/CoreBlueprints/Items/Armor/Saddles/PrimalItemArmor_ArgentavisSaddle.PrimalItemArmor_ArgentavisSaddle'\"  1 3 0|AdminCheat giveitem \"Blueprint'/Game/PrimalEarth/CoreBlueprints/Items/Armor/Saddles/PrimalItemArmor_DoedSaddle.PrimalItemArmor_DoedSaddle'\"  1 3 0|AdminCheat giveitem \"Blueprint'/Game/PrimalEarth/CoreBlueprints/Items/Armor/Saddles/PrimalItemArmor_PteroSaddle.PrimalItemArmor_PteroSaddle'\"  1 3 0|AdminCheat giveitem \"Blueprint'/Game/PrimalEarth/CoreBlueprints/Items/Consumables/PrimalItemConsumable_Narcotic.PrimalItemConsumable_Narcotic'\"  100 0 0|AdminCheat giveitem \"Blueprint'/Game/PrimalEarth/CoreBlueprints/Items/Consumables/PrimalItemConsumable_Narcotic.PrimalItemConsumable_Narcotic'\"  100 0 0|AdminCheat giveitem \"Blueprint'/Game/PrimalEarth/CoreBlueprints/Items/Consumables/PrimalItemConsumable_Narcotic.PrimalItemConsumable_Narcotic'\"  100 0 0|AdminCheat giveitem \"Blueprint'/Game/PrimalEarth/CoreBlueprints/Items/Consumables/PrimalItemConsumable_CookedLambChop.PrimalItemConsumable_CookedLambChop'\"  30 0 0|AdminCheat giveitem \"Blueprint'/Game/PrimalEarth/CoreBlueprints/Items/Consumables/PrimalItemConsumable_CookedLambChop.PrimalItemConsumable_CookedLambChop'\"  30 0 0|AdminCheat giveitem \"Blueprint'/Game/PrimalEarth/CoreBlueprints/Items/Consumables/PrimalItemConsumable_CookedLambChop.PrimalItemConsumable_CookedLambChop'\"  30 0 0|AdminCheat giveitem \"Blueprint'/Game/PrimalEarth/CoreBlueprints/Items/Consumables/PrimalItemConsumable_CanteenRefill.PrimalItemConsumable_CanteenRefill'\"  1 0 0|AdminCheat giveitem \"Blueprint'/Game/Extinction/CoreBlueprints/Items/Consumables/PrimalItemConsumable_Kibble_Base_Special_EX.PrimalItemConsumable_Kibble_Base_Special_EX'\" 50 0 0|AdminCheat giveitem \"Blueprint'/Game/Aberration/CoreBlueprints/Items/Armor/PrimalItemArmor_Glider.PrimalItemArmor_Glider'\" 1 0 0|" +
                "AdminCheat giveitem \"Blueprint'/Game/PrimalEarth/CoreBlueprints/Items/Structures/Misc/PrimalItemStructure_StorageBox_Large.PrimalItemStructure_StorageBox_Large'\" 1 0 0|AdminCheat giveitem " +
                "\"Blueprint'/Game/PrimalEarth/CoreBlueprints/Items/Consumables/PrimalItemConsumable_Kibble_Base_Special.PrimalItemConsumable_Kibble_Base_Special'\" 20 0 0|AdminCheat giveitem " +
                "\"Blueprint'/Game/PrimalEarth/CoreBlueprints/Items/Structures/Metal/PrimalItemStructure_MetalFloor.PrimalItemStructure_MetalFloor'\" 9 0 0|Admincheat GMSummon \"Argent_Character_BP_C\" 150";

        String[] split = str.split("\\|");
        List<String> gifts = new ArrayList<>();
        for (String s : split) {
            boolean giveitem = s.contains("giveitem");
            String result = "";
            if (giveitem) {
                result = s.replace("AdminCheat", "GiveItemToEOSId");
                result = result.replace("giveitem", "#playerId");
            }
            gifts.add(result);
        }


        for (String gift : gifts) {
            System.out.println(gift);
        }
    }
}
